package com.petshop.controller;

import com.petshop.service.LikesService;
import com.petshop.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("like")
@CrossOrigin
public class LikesController {
    @Autowired
    private LikesService likesService;

    /*
    点赞与取消点赞的切换
     */
//    @GetMapping("toggleLike")
//    public Result toggleLike(Integer postId,@RequestHeader("Authorization") String token) {
//        Result result = likesService.toggleLike(postId);
//        return result;
//    }

    /*
    根据帖子id查询帖子的获赞数量
     */
    @GetMapping("getLikes")
    public Result getLike(String postId) {
        Result result = likesService.getLike(postId);
        return result;
    }
}
